﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MailConfig.aspx.cs" Inherits="Lab9_Mailling.MailConfig" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">

        // Định nghĩa hàm chọn server mail và load các thông tin tương ứng với server mail được chọn
        function SelectServerMail() {
            var s = document.forms.frm.server_mail.value;
            switch (s) {
                case "smtp.gmail.com":
                    {
                        document.forms.frm.port.value = "587";
                        document.forms.frm.email.value = "tmdthca@gmail.com";
                        document.forms.frm.password.value = "tmdt123456";
                        break;
                    }
                case "smtp.mail.yahoo.com":
                    {
                        document.forms.frm.port.value = "465";
                        document.forms.frm.email.value = "tmdthca@yahoo.com";
                        document.forms.frm.password.value = "12345654321";
                        break;
                    }
                case "smtp.mail.yahoo.co.uk":
                    {
                        document.forms.frm.port.value = "465";
                        document.forms.frm.email.value = "tmdthca@yahoo.co.uk";
                        document.forms.frm.password.value = "12345654321";
                        break;
                    }
                case "smtp.live.com":
                    {
                        document.forms.frm.port.value = "587";
                        document.forms.frm.email.value = "tmdt@hotmail.com.vn";
                        document.forms.frm.password.value = "12345654321";
                        break;
                    }
                default:
                    {
                        document.forms.frm.port.value = "";
                        document.forms.frm.email.value = "";
                        document.forms.frm.password.value = "";
                        break;
                    }
            }
        }

//        // Định nghĩa hàm load giá trị mặc định cho form
//        function DefaultValue() {
//            document.forms.frm.port.value = "465";
//            document.forms.frm.email.value = "tmdthca@gmail.com";
//            document.forms.frm.password.value = "tmdt123456";
//        }

    </script>
    <style type="text/css">
        .style1
        {
            background-color: #6666FF;
        }
    </style>
</head>
<body >
    <form name="frm" method="get" action="Default.aspx?">
    <div>
        <table style="width: 30%;" align="center">
            <tr>
                <td colspan="2" style="background-color: #0000FF">
                    <strong>Mail Config</strong></td>
            </tr>
            <tr>
                <td class="style1">
                    Server Mail
                </td>
                <td class="style1">
                    <select id="server_mail" name="server_mail" onchange='SelectServerMail();'>
                        <option value="">---Chon Mail Server---</option>
                        <option value="smtp.gmail.com">smtp.gmail.com</option>
                        <%--<option value="smtp.mail.yahoo.com">smtp.mail.yahoo.com</option>
                        <option value="smtp.mail.yahoo.co.uk">smtp.mail.yahoo.co.uk</option>
                        <option value="smtp.live.com">smtp.live.com</option>--%>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Port
                </td>
                <td class="style1">
                    <input id="port" name="port" type="text" />
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Email
                </td>
                <td class="style1">
                    <input id="email" name="email" type="text" />
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Password
                </td>
                <td class="style1">
                    <input id="password" name="password" type="password" />
                </td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;
                </td>
                <td class="style1">
                   <%-- <asp:Button ID="accept" runat="server" Text="Accept" onclick="accept_Click" />--%>
                   <input id="submit" name="accept" value="Accept" type="submit" />
                </td> 
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
